package com.cskaoyan.controller.front;

import com.cskaoyan.bean.vo.back.BaseRespVo;
import com.cskaoyan.bean.vo.front.FrontShowGoodsCategoryVO;
import com.cskaoyan.bean.vo.front.ShowIndexVO;
import com.cskaoyan.service.front.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类目
 *
 * @auther 10-何兴绕
 * @Date 2022年10月14日 15:32
 */
@RestController
@RequestMapping("wx/catalog")
public class CatalogController {

    @Autowired
    CatalogService catalogService;

    /**
     * 商品类目页面展示
     * @return
     */
    @GetMapping("index")
    public BaseRespVo showIndex() {
        ShowIndexVO showIndexVO = catalogService.showIndex();
        return BaseRespVo.ok(showIndexVO);
    }

    /**
     * 根据id展示商品类目及子类目
     * @param id
     * @return
     */
    @GetMapping("current")
    public BaseRespVo showGoodsCate(Integer id) {
        FrontShowGoodsCategoryVO frontShowGoodsCategoryVO = catalogService.showGoodsCategory(id);
        return BaseRespVo.ok(frontShowGoodsCategoryVO);
    }
}
